<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.14"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>FabGL: VGA/FileBrowser/FileBrowser.ino</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
  $(document).ready(initResizable);
/* @license-end */</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="doxygen-awesome.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">FabGL
   </div>
   <div id="projectbrief">ESP32 Display Controller and Graphics Library</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.14 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(document).ready(function(){initNavTree('_v_g_a_2_file_browser_2_file_browser_8ino-example.html','');});
/* @license-end */
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="headertitle">
<div class="title">VGA/FileBrowser/FileBrowser.ino</div>  </div>
</div><!--header-->
<div class="contents">
<p>File browser (SPIFFS and SDCard) with GUI</p>
<div class="fragment"><div class="line"><span class="comment">/*</span></div><div class="line"><span class="comment">  Created by Fabrizio Di Vittorio (fdivitto2013@gmail.com) - &lt;http://www.fabgl.com&gt;</span></div><div class="line"><span class="comment">  Copyright (c) 2019-2021 Fabrizio Di Vittorio.</span></div><div class="line"><span class="comment">  All rights reserved.</span></div><div class="line"><span class="comment"></span></div><div class="line"><span class="comment"></span></div><div class="line"><span class="comment">* Please contact fdivitto2013@gmail.com if you need a commercial license.</span></div><div class="line"><span class="comment"></span></div><div class="line"><span class="comment"></span></div><div class="line"><span class="comment">* This library and related software is available under GPL v3.</span></div><div class="line"><span class="comment"></span></div><div class="line"><span class="comment">  FabGL is free software: you can redistribute it and/or modify</span></div><div class="line"><span class="comment">  it under the terms of the GNU General Public License as published by</span></div><div class="line"><span class="comment">  the Free Software Foundation, either version 3 of the License, or</span></div><div class="line"><span class="comment">  (at your option) any later version.</span></div><div class="line"><span class="comment"></span></div><div class="line"><span class="comment">  FabGL is distributed in the hope that it will be useful,</span></div><div class="line"><span class="comment">  but WITHOUT ANY WARRANTY; without even the implied warranty of</span></div><div class="line"><span class="comment">  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the</span></div><div class="line"><span class="comment">  GNU General Public License for more details.</span></div><div class="line"><span class="comment"></span></div><div class="line"><span class="comment">  You should have received a copy of the GNU General Public License</span></div><div class="line"><span class="comment">  along with FabGL.  If not, see &lt;http://www.gnu.org/licenses/&gt;.</span></div><div class="line"><span class="comment"> */</span></div><div class="line"></div><div class="line"></div><div class="line"><span class="comment">/*</span></div><div class="line"><span class="comment"> * Optional SD Card connections:</span></div><div class="line"><span class="comment"> *   MISO =&gt; GPIO 16  (2 for PICO-D4)</span></div><div class="line"><span class="comment"> *   MOSI =&gt; GPIO 17  (12 for PICO-D4)</span></div><div class="line"><span class="comment"> *   CLK  =&gt; GPIO 14</span></div><div class="line"><span class="comment"> *   CS   =&gt; GPIO 13</span></div><div class="line"><span class="comment"> *</span></div><div class="line"><span class="comment"> * To change above assignment fill other paramaters of FileBrowser::mountSDCard().</span></div><div class="line"><span class="comment"> */</span></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"><span class="preprocessor">#include &lt;Preferences.h&gt;</span></div><div class="line"><span class="preprocessor">#include &lt;WiFi.h&gt;</span></div><div class="line"><span class="preprocessor">#include &lt;HTTPClient.h&gt;</span></div><div class="line"><span class="preprocessor">#include &lt;stdio.h&gt;</span></div><div class="line"></div><div class="line"><span class="preprocessor">#include &quot;<a class="code" href="fabgl_8h.html">fabgl.h</a>&quot;</span></div><div class="line"><span class="preprocessor">#include &quot;<a class="code" href="fabui_8h.html">fabui.h</a>&quot;</span></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"><span class="preprocessor">#define FORMAT_ON_FAIL     true</span></div><div class="line"></div><div class="line"><span class="preprocessor">#define SPIFFS_MOUNT_PATH  &quot;/flash&quot;</span></div><div class="line"><span class="preprocessor">#define SDCARD_MOUNT_PATH  &quot;/SD&quot;</span></div><div class="line"></div><div class="line"></div><div class="line">Preferences preferences;</div><div class="line"></div><div class="line"><a name="_a0"></a><a class="code" href="classfabgl_1_1_v_g_a_controller.html">fabgl::VGAController</a> DisplayController;</div><div class="line"><a name="_a1"></a><a class="code" href="classfabgl_1_1_p_s2_controller.html">fabgl::PS2Controller</a> PS2Controller;</div><div class="line"></div><div class="line"></div><div class="line"><span class="keyword">class </span>MyApp : <span class="keyword">public</span> uiApp {</div><div class="line"></div><div class="line">  uiLabel *       WiFiStatusLbl;</div><div class="line">  uiFileBrowser * fileBrowser;</div><div class="line">  uiLabel *       freeSpaceLbl;</div><div class="line"></div><div class="line">  <span class="keywordtype">void</span> init() {</div><div class="line">    rootWindow()-&gt;frameStyle().backgroundColor = RGB888(0, 0, 64);</div><div class="line"></div><div class="line">    <span class="keyword">auto</span> frame = <span class="keyword">new</span> uiFrame(rootWindow(), <span class="stringliteral">&quot;FileBrowser Example&quot;</span>, Point(15, 10), Size(375, 275));</div><div class="line">    frame-&gt;frameProps().hasCloseButton = <span class="keyword">false</span>;</div><div class="line"></div><div class="line">    <span class="comment">// file browser</span></div><div class="line">    fileBrowser = <span class="keyword">new</span> uiFileBrowser(frame, Point(10, 25), Size(140, 180));</div><div class="line">    fileBrowser-&gt;setDirectory(<span class="stringliteral">&quot;/&quot;</span>);</div><div class="line">    fileBrowser-&gt;onChange = [&amp;]() {</div><div class="line">      updateFreeSpaceLabel();</div><div class="line">    };</div><div class="line"></div><div class="line">    <span class="comment">// create directory button</span></div><div class="line">    <span class="keyword">auto</span> createDirBtn = <span class="keyword">new</span> uiButton(frame, <span class="stringliteral">&quot;Create Dir&quot;</span>, Point(160, 25), Size(90, 20));</div><div class="line">    createDirBtn-&gt;onClick = [&amp;]() {</div><div class="line">      constexpr <span class="keywordtype">int</span> MAXSTRLEN = 16;</div><div class="line">      <span class="keywordtype">char</span> dirname[MAXSTRLEN + 1] = <span class="stringliteral">&quot;&quot;</span>;</div><div class="line">      <span class="keywordflow">if</span> (inputBox(<span class="stringliteral">&quot;Create Directory&quot;</span>, <span class="stringliteral">&quot;Name&quot;</span>, dirname, MAXSTRLEN, <span class="stringliteral">&quot;Create&quot;</span>, <span class="stringliteral">&quot;Cancel&quot;</span>) == uiMessageBoxResult::Button1) {</div><div class="line">        fileBrowser-&gt;content().makeDirectory(dirname);</div><div class="line">        updateBrowser();</div><div class="line">      }</div><div class="line">    };</div><div class="line"></div><div class="line">    <span class="comment">// create empty file button</span></div><div class="line">    <span class="keyword">auto</span> createEmptyFile = <span class="keyword">new</span> uiButton(frame, <span class="stringliteral">&quot;Create Empty File&quot;</span>, Point(160, 50), Size(90, 20));</div><div class="line">    createEmptyFile-&gt;onClick = [&amp;]() {</div><div class="line">      constexpr <span class="keywordtype">int</span> MAXSTRLEN = 16;</div><div class="line">      <span class="keywordtype">char</span> filename[MAXSTRLEN + 1] = <span class="stringliteral">&quot;&quot;</span>;</div><div class="line">      <span class="keywordflow">if</span> (inputBox(<span class="stringliteral">&quot;Create Empty File&quot;</span>, <span class="stringliteral">&quot;Name&quot;</span>, filename, MAXSTRLEN, <span class="stringliteral">&quot;Create&quot;</span>, <span class="stringliteral">&quot;Cancel&quot;</span>) == uiMessageBoxResult::Button1) {</div><div class="line">        <span class="keywordtype">int</span> len = fileBrowser-&gt;content().getFullPath(filename);</div><div class="line">        <span class="keywordtype">char</span> fullpath[len];</div><div class="line">        fileBrowser-&gt;content().getFullPath(filename, fullpath, len);</div><div class="line">        FILE * f = fopen(fullpath, <span class="stringliteral">&quot;wb&quot;</span>);</div><div class="line">        fclose(f);</div><div class="line">        updateBrowser();</div><div class="line">      }</div><div class="line">    };</div><div class="line"></div><div class="line">    <span class="comment">// rename button</span></div><div class="line">    <span class="keyword">auto</span> renameBtn = <span class="keyword">new</span> uiButton(frame, <span class="stringliteral">&quot;Rename&quot;</span>, Point(160, 75), Size(90, 20));</div><div class="line">    renameBtn-&gt;onClick = [&amp;]() {</div><div class="line">      <span class="keywordtype">int</span> maxlen = fabgl::imax(16, strlen(fileBrowser-&gt;filename()));</div><div class="line">      <span class="keywordtype">char</span> filename[maxlen + 1];</div><div class="line">      strcpy(filename, fileBrowser-&gt;filename());</div><div class="line">      <span class="keywordflow">if</span> (inputBox(<span class="stringliteral">&quot;Rename File&quot;</span>, <span class="stringliteral">&quot;New name&quot;</span>, filename, maxlen, <span class="stringliteral">&quot;Rename&quot;</span>, <span class="stringliteral">&quot;Cancel&quot;</span>) == uiMessageBoxResult::Button1) {</div><div class="line">        fileBrowser-&gt;content().rename(fileBrowser-&gt;filename(), filename);</div><div class="line">        updateBrowser();</div><div class="line">      }</div><div class="line">    };</div><div class="line"></div><div class="line">    <span class="comment">// delete button</span></div><div class="line">    <span class="keyword">auto</span> deleteBtn = <span class="keyword">new</span> uiButton(frame, <span class="stringliteral">&quot;Delete&quot;</span>, Point(160, 100), Size(90, 20));</div><div class="line">    deleteBtn-&gt;onClick = [&amp;]() {</div><div class="line">      <span class="keywordflow">if</span> (messageBox(<span class="stringliteral">&quot;Delete file/directory&quot;</span>, <span class="stringliteral">&quot;Are you sure?&quot;</span>, <span class="stringliteral">&quot;Yes&quot;</span>, <span class="stringliteral">&quot;Cancel&quot;</span>) == uiMessageBoxResult::Button1) {</div><div class="line">        fileBrowser-&gt;content().remove( fileBrowser-&gt;filename() );</div><div class="line">        updateBrowser();</div><div class="line">      }</div><div class="line">    };</div><div class="line"></div><div class="line">    <span class="comment">// format button</span></div><div class="line">    <span class="keyword">auto</span> formatBtn = <span class="keyword">new</span> uiButton(frame, <span class="stringliteral">&quot;Format&quot;</span>, Point(160, 125), Size(90, 20));</div><div class="line">    formatBtn-&gt;onClick = [&amp;]() {</div><div class="line">      <span class="keywordflow">if</span> (messageBox(<span class="stringliteral">&quot;Format sdcard&quot;</span>, <span class="stringliteral">&quot;Are you sure?&quot;</span>, <span class="stringliteral">&quot;Yes&quot;</span>, <span class="stringliteral">&quot;Cancel&quot;</span>) == uiMessageBoxResult::Button1) {</div><div class="line">        FileBrowser::format(fileBrowser-&gt;content().getCurrentDriveType(), 0);</div><div class="line">        updateBrowser();</div><div class="line">      }</div><div class="line">    };</div><div class="line"></div><div class="line">    <span class="comment">// setup wifi button</span></div><div class="line">    <span class="keyword">auto</span> setupWifiBtn = <span class="keyword">new</span> uiButton(frame, <span class="stringliteral">&quot;Setup WiFi&quot;</span>, Point(260, 25), Size(90, 20));</div><div class="line">    setupWifiBtn-&gt;onClick = [=]() {</div><div class="line">      <span class="keywordtype">char</span> SSID[32] = <span class="stringliteral">&quot;&quot;</span>;</div><div class="line">      <span class="keywordtype">char</span> psw[32]  = <span class="stringliteral">&quot;&quot;</span>;</div><div class="line">      <span class="keywordflow">if</span> (inputBox(<span class="stringliteral">&quot;WiFi Connect&quot;</span>, <span class="stringliteral">&quot;Network Name&quot;</span>, SSID, <span class="keyword">sizeof</span>(SSID), <span class="stringliteral">&quot;OK&quot;</span>, <span class="stringliteral">&quot;Cancel&quot;</span>) == uiMessageBoxResult::Button1 &amp;&amp;</div><div class="line">          inputBox(<span class="stringliteral">&quot;WiFi Connect&quot;</span>, <span class="stringliteral">&quot;Password&quot;</span>, psw, <span class="keyword">sizeof</span>(psw), <span class="stringliteral">&quot;OK&quot;</span>, <span class="stringliteral">&quot;Cancel&quot;</span>) == uiMessageBoxResult::Button1) {</div><div class="line">        preferences.putString(<span class="stringliteral">&quot;SSID&quot;</span>, SSID);</div><div class="line">        preferences.putString(<span class="stringliteral">&quot;WiFiPsw&quot;</span>, psw);</div><div class="line">        connectWiFi();</div><div class="line">      }</div><div class="line">    };</div><div class="line"></div><div class="line">    <span class="comment">// download file button</span></div><div class="line">    <span class="keyword">auto</span> downloadBtn = <span class="keyword">new</span> uiButton(frame, <span class="stringliteral">&quot;Download&quot;</span>, Point(260, 50), Size(90, 20));</div><div class="line">    downloadBtn-&gt;onClick = [=]() {</div><div class="line">      <span class="keywordtype">char</span> URL[128] = <span class="stringliteral">&quot;http://&quot;</span>;</div><div class="line">      <span class="keywordflow">if</span> (inputBox(<span class="stringliteral">&quot;Download File&quot;</span>, <span class="stringliteral">&quot;URL&quot;</span>, URL, <span class="keyword">sizeof</span>(URL), <span class="stringliteral">&quot;OK&quot;</span>, <span class="stringliteral">&quot;Cancel&quot;</span>) == uiMessageBoxResult::Button1) {</div><div class="line">        download(URL);</div><div class="line">        updateFreeSpaceLabel();</div><div class="line">      }</div><div class="line">    };</div><div class="line"></div><div class="line">    <span class="comment">// free space label</span></div><div class="line">    freeSpaceLbl = <span class="keyword">new</span> uiLabel(frame, <span class="stringliteral">&quot;&quot;</span>, Point(10, 235));</div><div class="line">    updateFreeSpaceLabel();</div><div class="line"></div><div class="line">    <span class="comment">// wifi status label</span></div><div class="line">    WiFiStatusLbl = <span class="keyword">new</span> uiLabel(frame, <span class="stringliteral">&quot;&quot;</span>, Point(10, 255));</div><div class="line">    connectWiFi();</div><div class="line"></div><div class="line">    setFocusedWindow(fileBrowser);</div><div class="line">  }</div><div class="line"></div><div class="line">  <span class="keywordtype">void</span> updateBrowser()</div><div class="line">  {</div><div class="line">    fileBrowser-&gt;update();</div><div class="line">    updateFreeSpaceLabel();</div><div class="line">  }</div><div class="line"></div><div class="line">  <span class="comment">// connect to wifi using SSID and PSW from Preferences</span></div><div class="line">  <span class="keywordtype">void</span> connectWiFi()</div><div class="line">  {</div><div class="line">    WiFiStatusLbl-&gt;setText(<span class="stringliteral">&quot;WiFi Not Connected&quot;</span>);</div><div class="line">    WiFiStatusLbl-&gt;labelStyle().textColor = RGB888(255, 0, 0);</div><div class="line">    <span class="keywordtype">char</span> SSID[32], psw[32];</div><div class="line">    <span class="keywordflow">if</span> (preferences.getString(<span class="stringliteral">&quot;SSID&quot;</span>, SSID, <span class="keyword">sizeof</span>(SSID)) &amp;&amp; preferences.getString(<span class="stringliteral">&quot;WiFiPsw&quot;</span>, psw, <span class="keyword">sizeof</span>(psw))) {</div><div class="line">      WiFi.begin(SSID, psw);</div><div class="line">      <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i &lt; 16 &amp;&amp; WiFi.status() != WL_CONNECTED; ++i) {</div><div class="line">        WiFi.reconnect();</div><div class="line">        delay(1000);</div><div class="line">      }</div><div class="line">      <span class="keywordflow">if</span> (WiFi.status() == WL_CONNECTED) {</div><div class="line">        WiFiStatusLbl-&gt;setTextFmt(<span class="stringliteral">&quot;Connected to %s, IP is %s&quot;</span>, WiFi.SSID().c_str(), WiFi.localIP().toString().c_str());</div><div class="line">        WiFiStatusLbl-&gt;labelStyle().textColor = RGB888(0, 128, 0);</div><div class="line">      }</div><div class="line">    }</div><div class="line">    WiFiStatusLbl-&gt;update();</div><div class="line">  }</div><div class="line"></div><div class="line">  <span class="comment">// download from URL. Filename is the last part of the URL</span></div><div class="line">  <span class="keywordtype">void</span> download(<span class="keywordtype">char</span> <span class="keyword">const</span> * URL) {</div><div class="line">    <span class="keywordtype">char</span> <span class="keyword">const</span> * slashPos = strrchr(URL, <span class="charliteral">&#39;/&#39;</span>);</div><div class="line">    <span class="keywordflow">if</span> (slashPos) {</div><div class="line">      <span class="keywordtype">char</span> filename[slashPos - URL + 1];</div><div class="line">      strcpy(filename, slashPos + 1);</div><div class="line"></div><div class="line">      HTTPClient http;</div><div class="line">      http.begin(URL);</div><div class="line">      <span class="keywordtype">int</span> httpCode = http.GET();</div><div class="line">      <span class="keywordflow">if</span> (httpCode == HTTP_CODE_OK) {</div><div class="line"></div><div class="line">        <span class="keywordtype">int</span> fullpathLen = fileBrowser-&gt;content().getFullPath(filename);</div><div class="line">        <span class="keywordtype">char</span> fullpath[fullpathLen];</div><div class="line">        fileBrowser-&gt;content().getFullPath(filename, fullpath, fullpathLen);</div><div class="line">        FILE * f = fopen(fullpath, <span class="stringliteral">&quot;wb&quot;</span>);</div><div class="line"></div><div class="line">        <span class="keywordtype">int</span> len = http.getSize();</div><div class="line">        uint8_t buf[128] = { 0 };</div><div class="line">        WiFiClient * stream = http.getStreamPtr();</div><div class="line">        <span class="keywordflow">while</span> (http.connected() &amp;&amp; (len &gt; 0 || len == -1)) {</div><div class="line">          <span class="keywordtype">size_t</span> size = stream-&gt;available();</div><div class="line">          <span class="keywordflow">if</span> (size) {</div><div class="line">            <span class="keywordtype">int</span> c = stream-&gt;readBytes(buf, fabgl::imin(<span class="keyword">sizeof</span>(buf), size));</div><div class="line">            fwrite(buf, c, 1, f);</div><div class="line">            <span class="keywordflow">if</span> (len &gt; 0)</div><div class="line">              len -= c;</div><div class="line">          }</div><div class="line">        }</div><div class="line"></div><div class="line">        fclose(f);</div><div class="line"></div><div class="line">        updateBrowser();</div><div class="line">      }</div><div class="line">    }</div><div class="line">  }</div><div class="line"></div><div class="line">  <span class="comment">// show used and free SD space</span></div><div class="line">  <span class="keywordtype">void</span> updateFreeSpaceLabel() {</div><div class="line">    int64_t total, used;</div><div class="line">    FileBrowser::getFSInfo(fileBrowser-&gt;content().getCurrentDriveType(), 0, &amp;total, &amp;used);</div><div class="line">    freeSpaceLbl-&gt;setTextFmt(<span class="stringliteral">&quot;%lld KiB used, %lld KiB free&quot;</span>, used / 1024, (total - used) / 1024);</div><div class="line">    freeSpaceLbl-&gt;update();</div><div class="line">  }</div><div class="line"></div><div class="line">} app;</div><div class="line"></div><div class="line"></div><div class="line"><span class="keywordtype">void</span> setup()</div><div class="line">{</div><div class="line">  <span class="comment">//Serial.begin(115200); delay(500); Serial.write(&quot;\n\n\n&quot;); // DEBUG ONLY</span></div><div class="line"></div><div class="line">  preferences.begin(<span class="stringliteral">&quot;FileBrowser&quot;</span>, <span class="keyword">false</span>);</div><div class="line"></div><div class="line">  PS2Controller.<a name="a2"></a><a class="code" href="classfabgl_1_1_p_s2_controller_ab8520612804a921ad834b41214a99c09.html#ab8520612804a921ad834b41214a99c09">begin</a>(PS2Preset::KeyboardPort0_MousePort1, KbdMode::GenerateVirtualKeys);</div><div class="line"></div><div class="line">  DisplayController.begin();</div><div class="line"></div><div class="line">  <span class="comment">// keep LOW!!! otherwise there isn&#39;t enough memory for WiFi!!!</span></div><div class="line">  DisplayController.<a name="a3"></a>setResolution(<a name="a4"></a><a class="code" href="fabglconf_8h_a8052201f91850dfc935be639a91da6ee.html#a8052201f91850dfc935be639a91da6ee">VGA_400x300_60Hz</a>);</div><div class="line"></div><div class="line">  <span class="comment">// adjust this to center screen in your monitor</span></div><div class="line">  <span class="comment">//DisplayController.moveScreen(-6, 0);</span></div><div class="line"></div><div class="line">  Canvas cv(&amp;DisplayController);</div><div class="line">  cv.clear();</div><div class="line">  cv.drawText(50, 170, <span class="stringliteral">&quot;Initializing...&quot;</span>);</div><div class="line">  cv.waitCompletion();</div><div class="line"></div><div class="line">  FileBrowser::mountSDCard(FORMAT_ON_FAIL, SDCARD_MOUNT_PATH);</div><div class="line">  FileBrowser::mountSPIFFS(FORMAT_ON_FAIL, SPIFFS_MOUNT_PATH);</div><div class="line">}</div><div class="line"></div><div class="line"></div><div class="line"><span class="keywordtype">void</span> loop()</div><div class="line">{</div><div class="line">  app.run(&amp;DisplayController);</div><div class="line">}</div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div></div><!-- fragment --> </div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="footer">Generated on Mon Aug 2 2021 07:08:02 for FabGL by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.14 </li>
  </ul>
</div>
</body>
</html>
